<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <ul>
      <li v-for="item in items" :key="item.id">
        <h5>{{item.name}}</h5>
        <img :src="item.pic" alt="">
      </li>
    </ul>
  </div>
  <script src="./vue.js"></script>
  <script src="./axios.js"></script>
  <script>
    const vm = new Vue({
      el: '#app',
      data: {
        // 在data中定义初始值
        items: []
      },
      created(){
        // 在这里调用 请求函数
        this.fetchItems()
      },
      methods: {
        fetchItems(){
          axios.post('https://api.it120.cc/conner/shop/goods/list/v2', {
            page: 1,
            pageSize: 5
          }).then(res=>{
            if(res.data.code === 0){
              this.items = res.data.data.result
            }
          })
        }
      }
    })
  </script>
</body>
</html>